package top.lshaci.learning.rule;

import java.math.BigDecimal;
import java.util.Optional;

/**
 * AddRule
 *
 * @author lshaci
 * @since 1.0.0
 */
public class AddRule extends AbstractAmountRule {

    @Override
    protected BigDecimal convert(RuleDto ruleDto) {
        return ruleDto.getAmount();
    }

    @Override
    protected BigDecimal doExec(Optional<BigDecimal> data) {
        return data.orElse(BigDecimal.ZERO).add(new BigDecimal("10"));
    }

    @Override
    public Integer type() {
        return 0;
    }
}
